package com.fita.admin.dao;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.fita.entity.authority.Resource;

import java.util.List;

/**
 * 
 * @author Ysy
 */
@Dao("hibernate")
public interface ResourceDao {
    
    /**
     * list resources by role_code
     * 
     * @param roleCode
     * @return
     */
    @Query("SELECT r.resource FROM RoleResource r WHERE r.roleCode = :roleCode ORDER BY r.resource.id ASC")
    public List<Resource> list(@Variable("roleCode") String roleCode);
    
}
